﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace web.ClientMgr
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                PmsClient.Gridviewnvl.ResetGridView(this.GridView1);
            }

            DataTable dt = new DataTable();
            dt.Columns.Add("RelaTypeID");
            dt.Columns.Add("RelaTypeNO");
            dt.Columns.Add("RelaTypeName");
            dt.Columns.Add("ClientID");
            PmsClient.Gridviewnvl.GridViewDataBind(this.GridView1, dt);

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            GridView1.DataSource = null;
            GridView1.DataSourceID = "SqlDataSource1";
            GridView1.DataBind();
            //if (((DataTable)GridView1.DataSource).Rows.Count == 0)
            if (GridView1.Rows.Count == 0 )
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("RelaTypeID");
                dt.Columns.Add("RelaTypeNO");
                dt.Columns.Add("RelaTypeName");
                dt.Columns.Add("ClientID");
                PmsClient.Gridviewnvl.GridViewDataBind(this.GridView1, dt);
            }
        }
    }
}
